import 'package:flutter/cupertino.dart';
import 'package:flutter_douban/config/app_config.dart';
import 'package:shared_preferences/shared_preferences.dart';

class CollectionCookModel with ChangeNotifier {
  List<String> _cookInfoList = [];
  CollectionCookModel(this._cookInfoList);

  /// 更新缓存数据
  void update() async {
    _cookInfoList = [];
    SharedPreferences prefs = await SharedPreferences.getInstance();
    List<String>? list = prefs.getStringList(AppConfig.collectionCook);
    if (list != null) {
      _cookInfoList.addAll(list);
    }
  }

  /// 获取缓存数据
  List get cookInfoList => _cookInfoList;
}
